<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
	</head>
	<body>
		
	</body>
</html>
<script>
	
	// function test() {
	// 	test();
	// }

	// 在函数内部直接或间接的调用函数本身(递归函数)
	function jieC(n) {
		if (n <= 1) return 1;
		return n * jieC(n - 1);
	}

	var r = jieC(5);
	console.log(r);


	// 字面量创建对象的方式
	var person = {
		name: "徐旺",
		age: 18,
		say: function() {
			console.log("他说自己不傻");
		}
	};

	console.log(person["name"]);
	console.log(person.age);
	person.say();

	var a = [];
	console.log(a);

	// key值为整数, 有length属性, 行为和数组类似的对象称为类数组对象
	var arr = {
		0: 1,
		1: 2,
		2: 3,
		3: 4,
		length: 4
	};
	console.log(arr);
	for (var i = 0; i < arr.length; i++) {
		console.log(arr[i]);
	}


	function sum() {
		// arguments是一个存放实参的类数组
		console.log(arguments);
		var sum = 0;
		for (var i = 0; i < arguments.length; i++) {
			sum += arguments[i];
			// console.log(arguments[i]);
		}
		return sum;
	}
	var r = sum(2, 3, 4, 5);
	console.log(r);






</script>